<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <title>mamis-editor</title>
    <script defer="defer" th:src="@{${contextPath}+'/amis/editor/vendor.6440830d5e07c0b5f2aa.js'}"></script>
    <script defer="defer" th:src="@{${contextPath}+'/amis/editor/main.957b282f92d003fa2b5e.js'}"></script>
    <script th:src="@{${contextPath}+'/amis/lib/jquery/jquery-3.6.3.min.js'}"></script>
    <script th:src="@{${contextPath}+${js}}"></script>
    <script type="text/javascript">
        jQuery = $.noConflict();
    </script>
    <script>
      const __mamis__contextPath = '[[${contextPath}]]';
      const __mamis__sysCode = '[[${sysCode}]]';
      AMIS_JSON = amisJSON;
      AMIS_ENV  = {
            requestAdaptor (api) {
              if (api.url.startsWith('//') ||
                 !api.url.startsWith('/') ||
                  api.url === __mamis__contextPath) {
                return api;
              }
              return {...api, url: __mamis__contextPath + api.url, headers: {...api.headers, 'mamis-sys-code': __mamis__sysCode } };
            }
      };
      AMIS_SAVE = function(schema) {
          jQuery.ajax({
                url: __mamis__contextPath + "/mamis/sys/page",
                type:"POST",
                headers: {
                  "mamis-sys-code": __mamis__sysCode
                },
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                data:JSON.stringify({
                    id: "[[${pageId}]]",
                    content: JSON.stringify(schema)
                }),
                success:function(data){
                    if(data.status == 0){
                        alert("保存成功");
                    }else{
                        alert("保存失败"+data.msg);
                    }
                }
          })
      };
    </script>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
  </body>
</html>